#!/bin/bash



GREP_PROCESS="get_dialogue_data_server.py"

##################### restart server #############################
PID_RANK=`ps -ef|grep "$GREP_PROCESS"|grep -v grep|awk '{print $2}'|xargs`
if [  "$PID_RANK" != "" ];then
    echo "-----Force kill current generate process"
    kill -9 $PID_RANK
fi

nohup python3 get_dialogue_data_server.py >> get_dialogue_data_server.log &

################## check if server startup ##########################
PID_RANK=`ps -ef|grep "$GREP_PROCESS"|grep -v grep|awk '{print $2}'`

if [  "$PID_RANK" == "" ];then
    echo "startup fail please check log file."
    exit 1
fi

echo "startup service success!!!"



